empty_list = []
numbers = [1, 2, 3, 4, 5]
fruits = ['apple','banana','橙子']
mixed = [1, 'hello', 3.14, True]
matrix = [[1, 2 ],[3, 4]]


print(fruits)

print(fruits[0])
print(fruits[-1])


print(numbers[1:3])
print(numbers[::2])
print(numbers[::-1])



fruits[1] = 'pear'
print(fruits)




fruits.append('grape')
fruits.insert(1,'kiwi')
print(fruits)





del fruits[0]
fruits.remove('pear')
popped = fruits.pop()
print(f"删除的元素: {popped}, 剩余列表: {fruits}")





nums = [3, 1, 4, 2]
nums.sort()
print(nums)



nums.reverse()
print(nums)



sorted_nums = sorted(nums, reverse=True)
print(sorted_nums)





letters = ['a', 'b', 'c', 'a', 'b']
print(letters.index('c'))
print(letters.count('a'))
print('d' in letters)





list1 = [1, 2]
list2 = [3, 4]
combined = list1 + list2
print(combined)


shallow_copy = list1.copy()
deep_copy = list1[:]



squares = [x**2 for x in range(5)]
print(squares)



even_squares = [x**2 for x in range(10) if x % 2 ==0]
print(even_squares)


matrix = [[1, 2], [3, 4], [5, 6]]
transposed = [[row[i] for row in matrix] for i in range(2)]
print(transposed)


students = ['Alice', 'Bob', 'Charlie']
scores = [85, 92, 78]



for name, score in zip(students,scores):
    print(f"{name}: {score}分")


max_score = max(scores)
top_student = students[scores.index(max_score)]
print(f"最高分: {top_student}({max_score}分)")






duplicates = [1, 2, 3, 4, 5]
unique = list(set(duplicates))
print(unique)







from collections import OrderedDict
unique_ordered = list(OrderedDict.fromkeys(duplicates))
print(unique_ordered)

